using System;
using UnityEngine;

public class ZombieLeagueStats : LeagueStats
{
	[SerializeField]
	[Header("Время")]
	private UILabel surviveTimeLabel;

	[SerializeField]
	private UILabel surviveTimeResult;

	[SerializeField]
	private UILabel surviveTimeCups;

	public int surviveCups;

	[SerializeField]
	[Header("Кто победил")]
	private UILabel teamWinsLabel;

	[SerializeField]
	private UILabel teamWinsResult;

	[SerializeField]
	private UILabel teamWinsCups;

	public int winCups;

	[Header("Убийства в качестве зомби")]
	[SerializeField]
	private UILabel zombieKillsLabel;

	[SerializeField]
	private UILabel zombieKillsResult;

	[SerializeField]
	private UILabel zombieKillsCups;

	public int zombieCups;

	[Header("Убийства в качестве человека")]
	[SerializeField]
	private UILabel humanKillsLabel;

	[SerializeField]
	private UILabel humanKillsResult;

	[SerializeField]
	private UILabel humanKillsCups;

	public int humanCups;

	public new void Init()
	{
		base.Init();
	}

	public void SetSurviveTimeLabel(float timeInSeconds, int stars)
	{
		TimeSpan timeSpan = TimeSpan.FromSeconds(timeInSeconds);
		if (timeSpan.Minutes > 0)
		{
			surviveTimeResult.text = string.Format("{0:D2}:{1:D2}", timeSpan.Minutes, timeSpan.Seconds);
		}
		else if (timeSpan.Seconds > 0)
		{
			surviveTimeResult.text = string.Format("0:{0:D2}", timeSpan.Seconds);
		}
		else
		{
			surviveTimeResult.text = "--:--";
		}
		surviveTimeCups.text = ((stars < 0) ? stars.ToString() : ("+ " + stars));
	}

	public void SetTeamWinsLabel(bool isWinnerTeam, int stars, bool isDraw = false)
	{
		teamWinsResult.text = string.Empty;
		teamWinsCups.text = ((stars < 0) ? stars.ToString() : ("+ " + stars));
		teamWinsLabel.color = (isDraw ? Color.white : ((!isWinnerTeam) ? Color.red : Color.green));
		teamWinsCups.color = ((stars >= 0) ? Color.green : Color.red);
	}

	public void SetZombieKillsLabel(int kills, int stars)
	{
		zombieKillsResult.text = kills.ToString();
		zombieKillsCups.text = ((stars < 0) ? stars.ToString() : ("+ " + stars));
		zombieKillsCups.color = ((stars >= 0) ? Color.green : Color.red);
	}

	public void SetHumanKillsLabel(int kills, int stars)
	{
		humanKillsResult.text = kills.ToString();
		humanKillsCups.text = ((stars < 0) ? stars.ToString() : ("+ " + stars));
		humanKillsCups.color = ((stars >= 0) ? Color.green : Color.red);
	}
}
